package net.slipp.bean;

import javax.sql.DataSource;

import org.apache.commons.dbcp2.BasicDataSource;

import spring.stereotype.Bean;
import spring.stereotype.Configuration;

@Configuration
public class IntegrationConfig {
	@Bean
	public DataSource dataSource() {
		BasicDataSource ds = new BasicDataSource();
		ds.setDriverClassName("org.h2.Driver");
		ds.setUrl("jdbc:h2:~/jwp-basic;AUTO_SERVER=TRUE");
		ds.setUsername("sa");
		ds.setPassword("");
		return ds;
	}
	
	@Bean
	public MyJdbcTemplate jdbcTemplate(DataSource dataSource) {
		return new MyJdbcTemplate(dataSource);
	}
}
